package kr.co.softtrain.glc.imagecrop;

import android.os.Build;
import android.view.MotionEvent;

public class CustomCropWrapMotionEvent {
	
	protected MotionEvent m_event;
	
	protected CustomCropWrapMotionEvent(MotionEvent event) {
		this.m_event = event;
		
	}
	
	public static CustomCropWrapMotionEvent wrap(MotionEvent event) {
		
		if (Integer.parseInt(Build.VERSION.SDK) >= Build.VERSION_CODES.ECLAIR)	 {
			return new CustomCropEclairMotionEvent(event);
			
		} else {
			return new CustomCropWrapMotionEvent(event);
			
		}
		
	}
	
	public int getAction() {
		return m_event.getAction();
		
	}

	public float getX() {
		return m_event.getX();
		
	}

	public float getX(int nPointerIndex) {
		verifyPointerIndex(nPointerIndex);
		
		return getX();
		
	}

	public float getY() {
		return m_event.getY();
	}

	public float getY(int nPointerIndex) {
		verifyPointerIndex(nPointerIndex);
		
		return getY();
		
	}

	public int getPointerCount() {
		return 1;
		
	}

	public int getPointerId(int nPointerIndex) {
		verifyPointerIndex(nPointerIndex);
		
		return 0;
		
	}

	private void verifyPointerIndex(int nPointerIndex) {
		if (nPointerIndex > 0) {
			throw new IllegalArgumentException("Invalid pointer index for Donut/Cupcake");
			
		}
		
	}
	
}
